package com.seata.stock.controller;

import com.seata.stock.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/****************************************************
 *
 * @author lbf
 * @date 2025/7/15 16:36
 ****************************************************/
@RestController
public class StockController {

    @Autowired
    private StockService stockService;

    @GetMapping("/stock/decr")
    public String decrement(){

        try{
            stockService.decrement();
        }catch (Exception e){
            throw new RuntimeException("减库存失败");
            //System.out.println("~~~~~~~~~~~~~~~~~~~~~减库存失败~~~~~~~~~~~~~");
        }


        return "库存-1";
    }
}
